﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcMusicStore.Models;

namespace MvcMusicStore.Controllers
{
    public class StoreController : Controller
    {
        MusicStoreEntities db = new MusicStoreEntities();
        
        //
        // GET: /Store/

        public ActionResult Index()
        {
            return View(db.Genres);
        }

        //store/browse?genre=rock
        public ActionResult Browse(string genre)
        {
            var genreModel = db.Genres.Include("Albums").Single(c => c.Name == genre);
            return View(genreModel);
        }

        //store/details/5
        public ActionResult Details(int id)
        {
            return View(db.Albums.Find(id));
        }


    }
}
